package github.leavesczy.reactivehttpsamples.util

import java.text.SimpleDateFormat
import java.util.Date

object DateHelper {

    fun format2String(millis: Long): String {
        val format = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
        return format.format(Date(millis))
    }

    fun convertMillis2TimeFormat(millis: Long):String{
        var seconds=millis/1000
        val hours = seconds / 3600; // 计算小时数
        val remainder = seconds % 3600; // 计算剩余秒数
        val minutes = remainder / 60; // 计算分钟数
         seconds = remainder % 60; // 计算剩余秒数

        return String.format("%02d:%02d:%02d", hours,minutes,seconds)
    }
}